<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>网上商城</title>
    <link rel="stylesheet" th:href="@{~/bootstrap/css/bootstrap.min.css}">
    <script th:src="@{~/js/jquery-3.2.1.min.js}"></script>
    <style>
        .content{
            margin: auto;
            width: 500px;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="content">
            <form class="form-horizontal" action="/goods/update" method="post" enctype="multipart/form-data">
                <input name="id" hidden th:value="${goods.id}"/>
                <input name="img" hidden th:value="${goods.img}"/>
                <div class="form-group">
                  <label for="goodsname" class="col-sm-2 control-label">商品名称</label>
                  <div class="col-sm-10">
                    <input type="text" class="form-control" name="goodsname" th:value="${goods.goodsname}" id="goodsname" placeholder="商品名称">
                  </div>
                </div>
                <div class="form-group">
                  <label for="type" class="col-sm-2 control-label">商品类别</label>
                  <div class="col-sm-10">
                    <select class="form-control" name="tid" id="type">
                        <option th:each="type : ${typeList}" th:selected="${type.id == goods.id}" th:value="${type.id}"  th:text="${type.tname}">1</option>
                    </select>
                  </div>
                </div>
                <div class="form-group">
                    <label for="price" class="col-sm-2 control-label">价格</label>
                    <div class="col-sm-10">
                        <input type="text" th:value="${goods.price}" name="price" class="form-control" id="price" placeholder="商品价格">
                    </div>
                </div>
                <div class="form-group">
                    <label for="img">图片</label>
                    <div class="col-sm-10">
                        <input type="file" name="mfile" id="img">
                        <p class="help-block"></p>
                        <img class="img-circle" width="30" height="30" th:src="@{~/img/{img}(img=${goods.img})}">
                    </div>
                </div>
                <div class="form-group">
                    <label for="content" class="col-sm-2 control-label">描述</label>
                    <div class="col-sm-10">
                        <input type="text" th:value="${goods.content}" name="content" class="form-control" id="content" placeholder="商品描述">
                    </div>
                </div>
                <div class="form-group">
                  <div class="col-sm-offset-2 col-sm-10">
                    <button type="submit" class="btn btn-info">修改</button>
                  </div>
                </div>
              </form>
        </div>
    </div>
</body>
</html>